import request from "@/api";
import {
    inputDataParamsType,
    lookTableDataParamsType,
    writeReportItemType,
    writeReportListParamsype,
    writeReportResType
} from "@/api/datWriteReport/type";
import {resData} from "@/api/goloalType";

//填报数据列表
export const getWriteReportList = (params: writeReportListParamsype) => request.get<any, resData<writeReportResType>>('/reportApi/inputdata/inputdata/list', {params})
//新建填报数据
export const addData = (params: writeReportItemType) => request.post<any, resData<any>>('/reportApi/inputdata/inputdata/add', params)
//获取数据列表的表头
export const getLookTableHeadrs = (params: { dataId: string | number }) => request.get<any, resData<any>>('/reportApi/inputdata/inputdata/headers', {params})
//获取数据列表的内容
export const getLookTableData = (params: lookTableDataParamsType) => request.get<any, resData<any>>('/reportApi/inputdata/inputdata/rows', {params})
//删除数据
export const deleteData = (params: { dataId: string }) => request.post<any, resData<any>>(`/reportApi/inputdata/inputdata/remove/${params.dataId}`)
//保存输入数据值
export const inputDataValue = (params: inputDataParamsType | any) => {
    // let formParams = new FormData()
    // for (let i in params) {
    //     formParams.append(i, params[i])
    // }
    // console.log(formParams,typeof formParams)
    return request.post<any, resData<any>>(`/reportApi/inputdata/inputdata/input_data_value`, params)
}
